#ifndef QVIMEDIT_H
#define QVIMEDIT_H
#include <QApplication>
#include <QtGui>
#include <QtCore> 
#include <QtGlobal>
#include <QtDebug>
#include <QDebug> 
#include <QtGui/QTextBrowser>
#include <QTextBrowser>
#include <QMimeData>
#include <QDir>
#include <QTextDocumentFragment>
#include <Qsci/qscilexerhtml.h>
#include <Qsci/qsciscintilla.h>
#include <QCompleter>


#include <QtCore/QVariant>
#include <QtGui/QAction>
#include <QtGui/QApplication>
#include <QtGui/QButtonGroup>
#include <QtGui/QCheckBox>
#include <QtGui/QGridLayout>
#include <QtGui/QGroupBox>
#include <QtGui/QHBoxLayout>
#include <QtGui/QLabel>
#include <QtGui/QPushButton>
#include <QtGui/QRadioButton>
#include <QtGui/QSpacerItem>
#include <QtGui/QTextEdit>
#include <QtGui/QVBoxLayout>
#include <QtGui/QWidget>


#include "main.h"
#include "bestqtidy.h"







class Ui_MeSearchDlg
{
public:
    QGridLayout *gridLayout;
    QHBoxLayout *hboxLayout;
    QGroupBox *groupBox_3;
    QGridLayout *gridLayout1;
    QHBoxLayout *hboxLayout1;
    QLabel *label;
    QTextEdit *wquery;
    QHBoxLayout *hboxLayout2;
    QLabel *label_2;
    QTextEdit *ramplace;
    QGroupBox *groupBox_2;
    QGridLayout *gridLayout2;
    QCheckBox *oosensi;
    QCheckBox *ooregularex;
    QHBoxLayout *hboxLayout3;
    QGroupBox *groupBox;
    QGridLayout *gridLayout3;
    QRadioButton *ssup;
    QRadioButton *ssdown;
    QVBoxLayout *vboxLayout;
    QPushButton *dd1;
    QPushButton *markall;
    QPushButton *dd3;
    QPushButton *dd2;
    QPushButton *dd4;

    void setupUi(QWidget *MeSearchDlg)
    {
    if (MeSearchDlg->objectName().isEmpty())
        MeSearchDlg->setObjectName(QString::fromUtf8("MeSearchDlg"));
    QSize size(655, 156);
    size = size.expandedTo(MeSearchDlg->minimumSizeHint());
    MeSearchDlg->resize(size);
    MeSearchDlg->setMinimumSize(QSize(655, 0));
    MeSearchDlg->setMaximumSize(QSize(16777215, 156));
    gridLayout = new QGridLayout(MeSearchDlg);
    gridLayout->setObjectName(QString::fromUtf8("gridLayout"));
    hboxLayout = new QHBoxLayout();
    hboxLayout->setObjectName(QString::fromUtf8("hboxLayout"));
    groupBox_3 = new QGroupBox(MeSearchDlg);
    groupBox_3->setObjectName(QString::fromUtf8("groupBox_3"));
    gridLayout1 = new QGridLayout(groupBox_3);
    gridLayout1->setObjectName(QString::fromUtf8("gridLayout1"));
    hboxLayout1 = new QHBoxLayout();
    hboxLayout1->setObjectName(QString::fromUtf8("hboxLayout1"));
    label = new QLabel(groupBox_3);
    label->setObjectName(QString::fromUtf8("label"));

    hboxLayout1->addWidget(label);

    wquery = new QTextEdit(groupBox_3);
    wquery->setObjectName(QString::fromUtf8("wquery"));
    wquery->setMaximumSize(QSize(16777215, 30));
    wquery->setAcceptRichText(false);

    hboxLayout1->addWidget(wquery);


    gridLayout1->addLayout(hboxLayout1, 0, 0, 1, 1);

    hboxLayout2 = new QHBoxLayout();
    hboxLayout2->setObjectName(QString::fromUtf8("hboxLayout2"));
    label_2 = new QLabel(groupBox_3);
    label_2->setObjectName(QString::fromUtf8("label_2"));

    hboxLayout2->addWidget(label_2);

    ramplace = new QTextEdit(groupBox_3);
    ramplace->setObjectName(QString::fromUtf8("ramplace"));
    ramplace->setMaximumSize(QSize(16777215, 30));
    ramplace->setAcceptRichText(false);

    hboxLayout2->addWidget(ramplace);


    gridLayout1->addLayout(hboxLayout2, 1, 0, 1, 1);


    hboxLayout->addWidget(groupBox_3);


    hboxLayout->addItem(new QSpacerItem(16, 114, QSizePolicy::Expanding, QSizePolicy::Minimum));

    groupBox_2 = new QGroupBox(MeSearchDlg);
    groupBox_2->setObjectName(QString::fromUtf8("groupBox_2"));
    gridLayout2 = new QGridLayout(groupBox_2);
    gridLayout2->setObjectName(QString::fromUtf8("gridLayout2"));
    oosensi = new QCheckBox(groupBox_2);
    oosensi->setObjectName(QString::fromUtf8("oosensi"));
    oosensi->setChecked(true);

    gridLayout2->addWidget(oosensi, 0, 0, 1, 1);

    ooregularex = new QCheckBox(groupBox_2);
    ooregularex->setObjectName(QString::fromUtf8("ooregularex"));

    gridLayout2->addWidget(ooregularex, 1, 0, 1, 1);


    hboxLayout->addWidget(groupBox_2);

    hboxLayout3 = new QHBoxLayout();
    hboxLayout3->setObjectName(QString::fromUtf8("hboxLayout3"));
    groupBox = new QGroupBox(MeSearchDlg);
    groupBox->setObjectName(QString::fromUtf8("groupBox"));
    gridLayout3 = new QGridLayout(groupBox);
    gridLayout3->setObjectName(QString::fromUtf8("gridLayout3"));
    ssup = new QRadioButton(groupBox);
    ssup->setObjectName(QString::fromUtf8("ssup"));

    gridLayout3->addWidget(ssup, 1, 0, 1, 1);

    ssdown = new QRadioButton(groupBox);
    ssdown->setObjectName(QString::fromUtf8("ssdown"));
    ssdown->setChecked(true);

    gridLayout3->addWidget(ssdown, 2, 0, 1, 1);


    hboxLayout3->addWidget(groupBox);

    vboxLayout = new QVBoxLayout();
    vboxLayout->setObjectName(QString::fromUtf8("vboxLayout"));
    dd1 = new QPushButton(MeSearchDlg);
    dd1->setObjectName(QString::fromUtf8("dd1"));

    vboxLayout->addWidget(dd1);

    markall = new QPushButton(MeSearchDlg);
    markall->setObjectName(QString::fromUtf8("markall"));

    vboxLayout->addWidget(markall);

    dd3 = new QPushButton(MeSearchDlg);
    dd3->setObjectName(QString::fromUtf8("dd3"));
    dd3->setEnabled(false);

    vboxLayout->addWidget(dd3);

    dd2 = new QPushButton(MeSearchDlg);
    dd2->setObjectName(QString::fromUtf8("dd2"));

    vboxLayout->addWidget(dd2);

    dd4 = new QPushButton(MeSearchDlg);
    dd4->setObjectName(QString::fromUtf8("dd4"));

    vboxLayout->addWidget(dd4);


    hboxLayout3->addLayout(vboxLayout);


    hboxLayout->addLayout(hboxLayout3);


    gridLayout->addLayout(hboxLayout, 0, 0, 1, 1);


    gridLayout->addItem(new QSpacerItem(251, 16, QSizePolicy::Minimum, QSizePolicy::Expanding), 1, 0, 1, 1);


    retranslateUi(MeSearchDlg);
    QObject::connect(dd4, SIGNAL(clicked()), MeSearchDlg, SLOT(hide()));
    QObject::connect(wquery, SIGNAL(undoAvailable(bool)), dd3, SLOT(setEnabled(bool)));

    QMetaObject::connectSlotsByName(MeSearchDlg);
    } // setupUi

    void retranslateUi(QWidget *MeSearchDlg)
    {
    MeSearchDlg->setWindowTitle(QApplication::translate("MeSearchDlg", "Search or Query replace  CTR+F", 0, QApplication::UnicodeUTF8));
    groupBox_3->setTitle(QApplication::translate("MeSearchDlg", "Search Word:", 0, QApplication::UnicodeUTF8));
    label->setText(QApplication::translate("MeSearchDlg", "Search:  ", 0, QApplication::UnicodeUTF8));
    label_2->setText(QApplication::translate("MeSearchDlg", "Replace:", 0, QApplication::UnicodeUTF8));
    ramplace->setDocumentTitle(QString());
    groupBox_2->setTitle(QApplication::translate("MeSearchDlg", "Option", 0, QApplication::UnicodeUTF8));
    oosensi->setText(QApplication::translate("MeSearchDlg", "case sensitive", 0, QApplication::UnicodeUTF8));
    ooregularex->setText(QApplication::translate("MeSearchDlg", "regular expression", 0, QApplication::UnicodeUTF8));
    groupBox->setTitle(QApplication::translate("MeSearchDlg", "Direction", 0, QApplication::UnicodeUTF8));
    ssup->setText(QApplication::translate("MeSearchDlg", "search up", 0, QApplication::UnicodeUTF8));
    ssdown->setText(QApplication::translate("MeSearchDlg", "search down", 0, QApplication::UnicodeUTF8));
    dd1->setText(QApplication::translate("MeSearchDlg", "Search word", 0, QApplication::UnicodeUTF8));
    markall->setText(QApplication::translate("MeSearchDlg", "Mark all", 0, QApplication::UnicodeUTF8));
    dd3->setText(QApplication::translate("MeSearchDlg", "Replace", 0, QApplication::UnicodeUTF8));
    dd2->setText(QApplication::translate("MeSearchDlg", "Replace all", 0, QApplication::UnicodeUTF8));
    dd4->setText(QApplication::translate("MeSearchDlg", "Close CTR+F", 0, QApplication::UnicodeUTF8));
    Q_UNUSED(MeSearchDlg);
    } // retranslateUi

};

namespace Ui {
    class MeSearchDlg: public Ui_MeSearchDlg {};
} // namespace Ui

class MeSearchDlg : public QWidget, public Ui::MeSearchDlg
{
     Q_OBJECT
//
public:
MeSearchDlg( QWidget* = 0 );
protected:
    QShortcut *shortcut_search;
private:
signals:
public slots:
    void SearchReplace();

};



typedef enum
{  
  PAGER_BROWSER,
  PAGER_SOURCE,
  STRICT_ONLY_SOURCE,
  PAGER_EDIT,
  PAGER_FOTO,
  PAGER_LOADING_FUNCTIONS,
  PAGER_ERROR_ONLINE,
  PAGER_UNKNOW
} STATUS_EDIT;





class QViScintilla : public QsciScintilla
{
     Q_OBJECT
//
public:	 
    QViScintilla( QWidget *parent = 0);
    ~QViScintilla();
    void setText( const QString txt );
    void SetNowSource(  QString txt );
    inline void Setup( const QString bg , uint finr ) { 
        BackgroundColor = bg; 
        filenummer = finr;
        UpdateIt();
    }
    private:
    QCompleter *completer;
    QCompleter *c;
    QMenu *OwnContextMenu();
    MeSearchDlg *searchdlg;
    QString FIND_WORD;
    QString REPLACETEXTER;
    int FindStartPosition;
    int LineStartSearch;
protected:
    void keyPressEvent(QKeyEvent *e);
    void StarterCompleter();
    QStringList ReadList(); 
    int fontsize;
    QFont WorkFonts;
    QString CURRENTWORD;
    QString BackgroundColor;
    QClipboard  *baseram;
    uint filenummer;
    int posX;
    int posY;
    int liner;
    int positr;
    bool captureMouse;
  void CreateAction();
  QAction *actionPscreen,
        *actionSave,
        *sourceInsertdate,
        *sourceInsertJava,
        *sourceactionBold,
        *sourceactionItalic,
        *sourceReformatClipboardText,
        *sourceToParam,
        *sourceTidy,
        *sourceToh1,
        *actionRedo,
        *actionCut,
        *actionCopy,
        *actionCleanertext,
        *visiblespace;
    QShortcut *shortcut7;
    QString Cleaner( QString html4 );
    QShortcut *shortcut8;
    QShortcut *shortcut_search;
    QShortcut *shortcut11;
    QSettings setter;
    QString XHTML;
    QString StreamXHTML;
    int numerobase;
    QShortcut *shortcut0;
    QShortcut *shortcut1;
signals:
    void SaveStreamer();
    void TakeText( const QString txt );
public slots:
    void Owncontex(QPoint);
    void SaveCurrentDoc();   /* save doc */
    void PaintNewText();
    void UpdateIt();
    void VisibleSpaceEditor( bool set );
    void SetBoldSelected();
    void SetItalicSelected();
    void RefPasteText();
    void SetUnderlineSelected();
    void InsertDateNow();
    void InsertJavaNow();
    void SetToParaSelected();
    void SetToHTitSelected();
    void CursorAtIndex(int line ,int cool );
    void insertCompletion( QString completion );
    void SearchReplace();
    void GotoNextResult();
    void FinderReplace();
   

};







//
#endif // QVIMEDIT_H

